package sketch.generator;

import java.util.Collections;
import java.util.List;

import sketch.generator.examples.ExhaustiveSequatialValueGenerator;

public class ArrayValueGenerator<T> extends ValueGenerator<List<T>> {
	
	private final ExhaustiveSequatialValueGenerator<T> innerGenerator;
	
	public ArrayValueGenerator(T...values) {
		super();
		innerGenerator = new ExhaustiveSequatialValueGenerator<T>(values);
	}
	
	public ArrayValueGenerator(List<T> values) {
		super();
		innerGenerator = new ExhaustiveSequatialValueGenerator<T>(values);
	}

	@Override
	public List<T> composeData() {
		throw new UnsupportedOperationException();
	}

	@Override
	public boolean hasNext() {
		return this.innerGenerator.hasNext();
	}

	@Override
	protected List<T> generateNext() {
		return this.innerGenerator.next().getValues();
	}

	@Override
	public void reset() {
		super.reset();
		this.innerGenerator.reset();
	}

	@Override
	public List<List<T>> nextWrappedValue() {
		List<T> t = this.generateNext();
		return Collections.singletonList(t);
	}
}
